<script>
import WebLogo from "../../components/WebLogo.vue";
import {userDetail} from "../../api/user";

export default {
    name: "Resume",
    components: {WebLogo},
    data() {
        return {
            selectNav: 1,
            user:{},
            id:null,
        }
    },
    methods: {
        init(){
            this.id = this.$route.params['id']
            userDetail(this.id)
            .then(res=>{
                if(res.code===200){
                    this.user=res.data
                }
            })
        }
    },
    created() {
        this.init()
    }
}
</script>

<template>
    <div class="resume-body">
        <!--        头部-->
        <div class="resume-header">
            <!--            背景图标-->
            <div class="resume-header-back"></div>
            <div class="log">
                <WebLogo/>
            </div>

            <!--            背景内容-->
            <div class="flex column align-center resume-header-content">
                <!--                头像-->
                <div style="width: 264px;height: 250px">
                    <div class="header-img-div  animate__animated animate__bounce">
                        <div class="header-img" style="width: 264px;height: 256px">
                            <img src="/resume/13.png" alt="">
                        </div>
                        <div class="flex center align-center header-img" style="width: 264px;height: 250px">
                            <img :src="user.avatar" alt=" " style="width: 180px;height: 180px;border-radius: 50%">
                        </div>
                    </div>
                </div>
                <span style="font-size: 24px;">{{ user.name }}</span>
                <span style="font-size: 20px;font-weight: bolder">
                    <span style="color: rgb(255, 192, 1);">—</span>
                    <span style="color: rgb(255, 192, 1);">—</span>
                </span>
                <span style="color: rgb(119, 119, 119);font-size: 14px;margin-top: 5px">对代码保持好奇心、目的和激情，始终如一</span>
                <div class="flex row space-between" style="width: 580px;height: 55px;margin-top: 10px">
                    <div @click="selectNav=1" class="flex center align-center"
                         :class="selectNav===1 ? 'nav-item-active': 'nav-item'">
                        <router-link class="nav-item-font" :to="'/resume/'+id">主页</router-link>
                    </div>
                    <div @click="selectNav=2" class="flex center align-center"
                         :class="selectNav===2 ? 'nav-item-active': 'nav-item'">
                        <router-link class="nav-item-font" :to="'/resume/log/'+id">日志</router-link>
                    </div>
                    <div @click="selectNav=3" class="flex center align-center"
                         :class="selectNav===3 ? 'nav-item-active': 'nav-item'">
                        <router-link class="nav-item-font" :to="'/resume/photo/'+id">相册</router-link>
                    </div>
                    <div @click="selectNav=4" class="flex center align-center"
                         :class="selectNav===4 ? 'nav-item-active': 'nav-item'">
                        <router-link class="nav-item-font" :to="'/resume/info/'+id">个人档</router-link>
                    </div>
                    <div @click="selectNav=5" class="flex center align-center"
                         :class="selectNav===5 ? 'nav-item-active': 'nav-item'">
                        <router-link class="nav-item-font" :to="'/resume/share/'+id">分享</router-link>
                    </div>
                </div>
            </div>
        </div>
        <router-view/>
    </div>
</template>

<style lang="scss" scoped>
.log{
    position: absolute;
    height: 50px;
    cursor: pointer;
    z-index: 2;
}
.nav-item {
    cursor: pointer;
    color: rgb(255, 192, 1);
    font-size: 16px;
    font-family: 微软雅黑;
    text-decoration: none;
    width: 100px;
    height: 55px;

    .nav-item-font {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 55px;
        width: 100px;
        font-weight: normal;
        color: #666;
    }
}

.nav-item-active {
    cursor: pointer;
    color: rgb(255, 192, 1);
    font-size: 16px;
    font-family: 微软雅黑;
    text-decoration: none;
    width: 100px;
    height: 55px;
    border-bottom: 2px solid;

    .nav-item-font {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 55px;
        width: 100px;
        font-weight: normal;
        color: rgb(255, 192, 1);
    }
}

.nav-item:hover {
    border-bottom: 2px solid;

    .nav-item-font {
        font-weight: normal;
        color: rgb(255, 192, 1);
    }
}

.header-img-div {
    position: relative;
}

.header-img {
    position: absolute;
}

.resume-header-content {
    position: absolute;
    height: 410px;
    width: 100%;
}

.resume-header-back {
    background-image: url("/resume/12.jpg");
    height: 410px;
    width: 100%;
    position: absolute;
}

.resume-header {
    position: relative;
    height: 410px;
    width: 100%;
}

.resume-body {
    width: 100%;
    height: 100%;
    font-size: 14px;
    font-weight: normal;
    text-decoration: none;
    font-family: 微软雅黑;
    color: #222222;
    background: #fff;
    display: block;
}

</style>
